USE [Forums]
GO

/****** Object:  StoredProcedure [dbo].[SPAnswerGetByQuestion]    Script Date: 08/10/2012 14:29:21 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


CREATE PROCEDURE [dbo].[SPAnswerGetByQuestion]
	@q_ID int
AS
BEGIN TRY
	BEGIN TRANSACTION
	
	SELECT
		answerID, q_ID, answer, voted, isBest, answerDate, userID
	from 
		ask_answers
	WHERE q_ID = @q_ID
	COMMIT

END TRY
BEGIN CATCH
	IF @@TRANCOUNT > 0
		ROLLBACK

  -- Raise an error with the details of the exception
	DECLARE @ErrMsg nvarchar(4000), @ErrSeverity int
	SELECT @ErrMsg = ERROR_MESSAGE(),
		 @ErrSeverity = ERROR_SEVERITY()

	RAISERROR(@ErrMsg, @ErrSeverity, 1)

END CATCH


GO


